home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_show / parking / ticket.e < prev   
Encoding:
Text File  |  1997-04-13  |  859 b   |  38 lines  |  [TEXT/ttxt]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TICKET
  5.  
  6. creation {ANY}
  7.    make
  8.  
  9. feature {ANY} -- Consultations :
  10.    
  11.    arrival_time: DATE;
  12.    
  13.    price(departure_time: DATE; hour_price: REAL): REAL is
  14.       require
  15.      departure_time >= arrival_time;
  16.       local
  17.      nb_min: ARRAY[INTEGER];
  18.       do
  19.      nb_min := arrival_time.day_night_to(departure_time);
  20.      io.put_string("%Ncoucocu%N");
  21.      io.put_integer(nb_min @ nb_min.lower);
  22.      io.put_string("%N");
  23.      io.put_integer(nb_min @ nb_min.upper);
  24.      Result := (((hour_price/4) * (nb_min @ nb_min.upper))
  25.             + (hour_price * (nb_min @ nb_min.lower))) / 60;
  26.       end;
  27.  
  28. feature {ANY}
  29.    
  30.    make (arrival: DATE) is
  31.       do
  32.      arrival_time := arrival;      
  33.       ensure
  34.      arrival_time = arrival;      
  35.       end;
  36.  
  37. end -- class TICKET
  38.